#include<stdio.h>
#include<string.h>
extern int i,j,k,length,search_num;

void switch_f(char str[3][100])
{
 int i = strcmp(str[0],str[1]);
 int j = strcmp(str[0],str[2]);
 int k = strcmp(str[1],str[2]);
    switch(i)
    {
     case 1:switch(j)
     {
        case 1:printf("%s",str[0]);break;
        case 0:printf("%s",str[2]);break;
        case -1:printf("%s",str[2]);break;
     }break;
     case 0:switch(j)
     {
        case 1:printf("%s %s",str[0],str[1]);break;
        case 0:printf("%s %s %s",str[0],str[1],str[2]);break;
        case -1:printf("%s",str[2]);break;
     }break;
     case -1:switch(j)
     {
        case 1:printf("%s",str[1]);break;
        case 0:printf("%s",str[1]);break;
        case -1:switch(k)
        {
            case 1:printf("%s",str[1]);break;
            case 0:printf("%s %s",str[1],str[2]);break;
            case -1:printf("%s",str[2]);break;
        }
     }break;
    }
    printf("\n");
}

void scan_f(int arr[])
{
   printf("input data\n");
    for(int i=0;i<length;i++)
    {
      scanf("%d",&arr[i]);
    }
}

void binary_scan(int arr[])
{
 for(int i=0;i<length;i++)
 {
   int low = i+1,high =length-1;
   while(low<=high)
   {
      int mid = (high-low)/2+low;
      if(arr[mid]==search_num-arr[i])
      {
         printf("[%d %d]",i,mid);
         break;
      }
      else if (arr[mid]>search_num-arr[i])
      {
         high = mid-1;
      }
      else
      {
         low = mid+1;
      }
   }
 }
}